//
//  XQGoogleMarket.m
//  JoinPeso
//
//  Created by 小琦 on 2024/11/29.
//

#import "XQGoogleMarket.h"
#import "XQDevice.h"

@implementation XQGoogleMarket

+ (void)reportIdfv {
    NSDictionary *dic = @{
        @"making" : [XQDevice getIDFV],
        @"bright" : [XQDevice getIDFA],
    };
    
    [XQAFNetworking postWithUrl:[XQNetManager getAbsolutePath:@"/direct/ast"] pars:dic callback:^(_Bool success, id  _Nonnull responseObject, NSError * _Nonnull error) {
        
    }];
}

+ (void)reportLocation {
    
    NSDictionary *dic = [[XQToolManager manager] getLoacationInfo];
    
    [XQAFNetworking postWithUrl:[XQNetManager getAbsolutePath:@"/direct/rakuten"] pars:dic callback:^(_Bool success, id  _Nonnull responseObject, NSError * _Nonnull error) {
       
    }];
}

+ (void)reportDevice {
    NSDictionary *dic = @{
        @"accomplish" : [[XQToolManager manager] getDeviceInfo]
    };
    [XQAFNetworking postWithUrl:[XQNetManager getAbsolutePath:@"/direct/spacemobile"] pars:dic callback:^(_Bool success, id  _Nonnull responseObject, NSError * _Nonnull error) {
    }];
}

+ (void)reportRiskWithType:(NSString *)type longitude:(CGFloat)longitude latitude:(CGFloat)latitude startTime:(long long)startTime endTime:(long long)endTime orderId:(NSString *)orderId {
    
    NSDictionary *dic = @{
        @"adjustments" : type,
        @"orientation" : @"2",
        @"work" : [XQDevice getIDFV],
        @"shortly" : [XQDevice getIDFA],
        @"methods" : longitude == 0 ? @"0" : [NSString stringWithFormat:@"%.6f",longitude],
        @"mitigating" : latitude == 0 ? @"0" : [NSString stringWithFormat:@"%.6f",latitude],
        @"disputed" : [NSString stringWithFormat:@"%lld",startTime],
        @"professional" : [NSString stringWithFormat:@"%lld",endTime],
        @"stacking" : orderId
    };
    
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        [XQAFNetworking postWithUrl:[XQNetManager getAbsolutePath:@"/direct/telef"] pars:dic callback:^(_Bool success, id  _Nonnull responseObject, NSError * _Nonnull error) {

        }];
    });
}

@end
